package br.ufpb.di.ppgi.negocio;

import br.com.caelum.vraptor.ioc.Component;
import br.com.caelum.vraptor.ioc.Container;
import br.ufpb.di.ppgi.negocio.iservicos.IAlunoService;
import br.ufpb.di.ppgi.negocio.iservicos.IDefesaService;
import br.ufpb.di.ppgi.negocio.iservicos.ILoginService;
import br.ufpb.di.ppgi.negocio.iservicos.IProfessorExternoService;
import br.ufpb.di.ppgi.negocio.iservicos.IPropostaService;
import br.ufpb.di.ppgi.negocio.iservicos.IService;
import br.ufpb.di.ppgi.negocio.iservicos.IUsuarioService;

@Component
public class ServiceLocator {
	private final Container container;
	
	public ServiceLocator(Container container) {
		this.container = container;
	}
	
	protected <E extends IService> E on(Class<E> target) {
		return container.instanceFor(target);
	}
	
	public ILoginService forLogin() {
		return on(ILoginService.class);
	}
	
	public IUsuarioService forUsuario() {
		return on(IUsuarioService.class);
	}

	public IPropostaService forProposta() {
		return on(IPropostaService.class);
	}

	public IAlunoService forAluno() {
		return on(IAlunoService.class);
	}

	public IProfessorExternoService forProfessorExterno() {
		return on(IProfessorExternoService.class);
	}
	
	public IDefesaService forDefesa() {
		return on(IDefesaService.class);
	}
}
